Align subtree definition with latest specs - #254
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #254 +/- ##
==========================================
- Coverage 48.01% 46.57% -1.45%
==========================================
Files 8 8
Lines 933 977 +44
==========================================
+ Hits 448 455 +7
- Misses 476 511 +35
- Partials 9 11 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Replace the wrapper around invalidConsistencyProof with a dedicated invalidSubtreeConsistencyProof function in cmd/proofgen/main.go. TAG=agy CONV=1f76bf92-7d8b-43a5-942a-a4bd88025626
Update FindSubtrees in proof/proof.go to return two Subtree structs by value instead of allocating a []Subtree slice. TAG=agy CONV=1f76bf92-7d8b-43a5-942a-a4bd88025626
AlCutter
reviewed
Jul 23, 2026
| func FindSubtrees(start, end uint64) ([]Subtree, error) { | ||
| if start >= end { | ||
| return nil, fmt.Errorf("start %d must be strictly less than end %d", start, end) | ||
| func FindSubtrees(start, end uint64) (Subtree, Subtree, error) { |
Collaborator
There was a problem hiding this comment.
Now that we now always return two subtrees, and those subtrees are guaranteed to be touching, we should ditch the Subtree struct and just return start, mid, end.
This makes it impossible to return non-adjacent ranges, and gets rid of the asymmetry where we return a struct representing subtrees here, but don't take the same subtree struct as an argument anywhere else.
AlCutter
approved these changes
Jul 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updates subtree consistency proof generation, verification, and test vectors to align with recent changes in ietf-plants-wg/merkle-tree-certs:
Specifically:
start == endis now treated as a valid 0-length subtree. Subtree consistency proofs for empty subtrees return an empty array and verify that the subtree root equals the empty tree hash (HASH()), without depending on the parent tree's root.FindSubtreesedge case: Intervals of size <= 1 now return two subtrees ([start, end)and[end, end)) instead of one. It now returns two subtrees instead of returning an array.start == end), updated reference vectors to match the new rolling SHA-256 digests, and added empty subtree test cases toproofgen. Take this as an opportunity to definestaticSubtreeConsistencyProbesandinvalidSubtreeConsistencyProofstatically, rather than dynamically from consistency proof equivalents.Towards #225